package design.templateMethod;

/**
 * \* User: Administrator
 * <p>
 * \* Date: 2020/9/21
 * <p>
 * \* Time: 15:05
 * <p>
 * \* Description:
 * \
 */
public abstract class AbstractTemplate {
    private boolean flag = true;
    protected abstract void doSomething();
    protected abstract void doAnything();
    protected void canDoAny(boolean bool) {
        this.flag = bool;
    }

    public final void templateMethod() {
        if (this.flag) {
            this.doAnything();
        }
        this.doSomething();
    }
}
